<%@page import="approval.ApprovalDTO"%>
<%@page import="java.util.List"%>
<%@page import="approval.ApprovalDAO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>    
<% request.setCharacterEncoding("UTF-8"); %>  

<jsp:useBean id="dto" class="approval.ApprovalDTO" />
<jsp:setProperty property="*" name="dto"/>

<script>
function openViewWindow(ap_no, gubun) {
	window.open("../intranet/approval/ap_popup.jsp?ap_no="+ap_no+"&gubun="+gubun, "_blank", "resizable=yes, top=100, left=200, width=630, height=530");
}
</script>

<%
ApprovalDAO dao = new ApprovalDAO();
dao.setDto(dto);
dto.setFind((String)request.getParameter("find"));
/* System.out.println("sa_no_nm : "+dto.getSa_no_nm());
System.out.println("ct_no : "+dto.getCt_no());
System.out.println("Ct_ing : "+dto.getCt_ing());
System.out.println("Ap_sdt : "+dto.getAp_sdt());
System.out.println("Ap_req_sa_nm : "+dto.getAp_req_sa_nm()); */
/* System.out.println("nowPage를 찍어보겠습니다 : "+request.getParameter("nowPage"));
dto.setNowPage(Integer.parseInt(request.getParameter("nowPage"))); */
List<ApprovalDTO> ap = dao.list();
%>  

<table class="table"
		style="width: 1200px; margin: 0 auto;" id="tableDiv">
		<thead style="background-color: #e5e5e5;">
			<tr>
				<th>결재번호</th>
				<th>계약번호</th>
				<th>사원명</th>
				<th>상태</th>
				<th>신청일자</th>
				<th>상신자</th>
				<th>승인자</th>
				<th>등록자</th>
				<th>등록일</th>
				<th>수정자</th>
				<th>수정일</th>
			</tr>
		</thead>
		<tbody align="center">
			<tr>
			<%
			if(ap == null) return;
			for(int i=0; i<ap.size(); i++){
				ApprovalDTO gun = ap.get(i);
			%>
				<td><a href="#" onclick="openViewWindow('<%=gun.getAp_no() %>', 'ap_list')"><%=gun.getAp_no() %></a></td>
				<td><%=gun.getCt_no() %></td>
				<td><%=gun.getSa_no_nm() %></td>
				<td><%=gun.getCt_ing_nm() %></td>
				<td><%=gun.getAp_req_time() %></td>
				<td><%=gun.getAp_req_sa_nm() %></td>
				<td><%=gun.getAp_ap_sa_nm() %></td>
				<td><%=gun.getRg_pp_nm() %></td>
				<td><%=gun.getRg_dt() %></td>
				<td><%=gun.getMd_pp_nm() %></td>
				<td><%=gun.getMd_dt() %></td>
			</tr>
			<%} %>
		</tbody>
	</table>